package com.sc.iconfont;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        //代码设置图片
        TextView tv = (TextView) findViewById(R.id.tv);
        //tv.setText(R.string.icon_font);//方法一
        tv.setText("\ue854");//方法一

        addViews();
    }

    private void addViews() {
        RecyclerView container = (RecyclerView) findViewById(R.id.container);
        container.setLayoutManager(new GridLayoutManager(this, 4));
        container.setAdapter(new IconFontAdapter(this));

    }


}
